import { app, ipcMain } from 'electron';

import IpcMessage from '../../preload/preload';
import MainCommonService from '../main-common-service';

export default class EnvIpcService {
  /**
   * Sets up all related ipc message listeners.
   */
  static setup(): void {
    this.getAppVersion();
    this.isDevEnv();
  }

  private static getAppVersion(): void {
    ipcMain.handle(IpcMessage.getAppVersion, async (): Promise<string> => app.getVersion());
  }

  private static isDevEnv(): void {
    ipcMain.handle(IpcMessage.isDevEnv, async (): Promise<boolean> => MainCommonService.isDevEnv);
  }
}
